<?php

namespace app\miniapp;

use app\common\cachemodel\MiniChannel;

/**
 * 是否展示下载条
 * @param $channelId
 * @return int|mixed
 * @throws \Exception
 */
function isShowDownloadBar($channelId)
{
    $channelInfo = (new MiniChannel())->getInfoById($channelId, ['is_show_download_bar']);
    if ($channelInfo)
    {
        $is_show_download_bar = $channelInfo['is_show_download_bar'];
    } else
    {
        $is_show_download_bar = 0;
    }
    return (int)$is_show_download_bar ?? 0;
}

function miniFortuneMonthConfig($mini_fortune_month_config)
{
    if (!$mini_fortune_month_config)
    {
        $mini_fortune_month_config = 5;
    }
    $time = time() + 86400 * $mini_fortune_month_config;

    $date = date('Y-m', $time);
    $date = explode('-', $date);
    return $date;
}
